#ifndef UDP_SENDER_HPP
#define UDP_SENDER_HPP

#include <cstddef>
#include <netinet/in.h>
#include <string>

class UdpSender {
  public:
    UdpSender();
    ~UdpSender();

    bool initialize(int port);
    bool sendData(const void *data, size_t length, const sockaddr_in &clientAddr);
    void close();

  private:
    int udpSocket;
    struct sockaddr_in serverAddr;
    static const size_t MAX_PACKET_SIZE = 1400;

    int sendUdpPacket(const void *data, size_t length, const sockaddr_in &clientAddr);
};

#endif // UDP_SENDER_HPP